package com.kxf.androidtestdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Window;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.kxf.utils.Util;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import dalvik.system.DexClassLoader;

/**
 * @ProjectName: AndroidTestDemo
 * @Package: com.kxf.androidtestdemo.activity
 * @ClassName: BaseActivity
 * @Description: java类作用描述
 * @Author: kuangxuefeng
 * @qq: 1024883177
 * @CreateDate: 2020/5/13 15:36
 */
public class BaseActivity extends AppCompatActivity {
    protected String tag = null;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        //这句代码必须写在setContentView()方法的前面,去掉AppCompatActivity标题栏
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

        super.onCreate(savedInstanceState);
        tag = this.getLocalClassName();

        Log.d(tag, "isExistSDCard=" + isExistSDCard());
        Log.d(tag, "onCreate======##>>>>>>" + android.os.Process.myPid() + "   getTaskId()=" + getTaskId());
    }

    private static boolean isExistSDCard() {
        return Environment.getExternalStorageState().equals(
                Environment.MEDIA_MOUNTED);
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d(tag, "onResume======##>>>>>>");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d(tag, "onPause======##>>>>>>");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(tag, "onDestroy======##>>>>>>");
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Log.i(tag, "BaseActivity onActivityResult " + requestCode+ " " + resultCode+ " ==>>>" + Util.getIntentExtrasToString(data));
    }
}
